{# vim: set et ts=8 sts=4 sw=4 ai: #}
{% extends "wiki.html" %}
{%block head %}
{{ super() }}
    <meta name="robots" content="noindex, nofollow"/>
    <link rel="alternate" type="application/rss+xml" title="Changelog RSS Feed" href="{{url_for("changelog_feed_rss", _external=True)}}" />
    <link rel="alternate" type="application/atom+xml" title="Changelog Atom Feed" href="{{url_for("changelog_feed_atom", _external=True)}}" />
{% endblock %}
{% block extra_nav %}{% endblock %}
{% block menu %}
{{ super() }}
{% include 'snippets/menu.html' %}
{% include 'snippets/menutree.html' %}
{% endblock %}
{% block content %}
<div class="w-full mw-full p-0 clearfix">
    <h2 class="float-left">Changelog</h2>
{# pagination #}
{% if pages|length > 0 %}
<nav aria-label="Pagination" class="float-right">
<div class="btn-group" role="group">
  <a class="btn btn-square" href="{{ url_for("changelog", revision=first_page) }}">
    <i class="fa fa-angle-double-left" aria-hidden="true"></i>
    <span class="sr-only">First page</span> <!-- sr-only = only for screen readers -->
  </a>
  <!-- Previous page -->
  {% if previous_page %}
  <a class="btn btn-square" href="{{ url_for("changelog", revision=previous_page) }}">
    <i class="fa fa-angle-left" aria-hidden="true"></i>
    <span class="sr-only">Previous page</span> <!-- sr-only = only for screen readers -->
  </a>
  {% else %}
  <span class="btn btn-square">
    <i class="fa fa-angle-left" aria-hidden="true"></i>
  </span>
  {% endif %}
  <!-- Pages -->
  {% for page in pages %}
  {% if page["dummy"] %}
  <span class="btn btn-square">...</span>
  {% else %}
  <a class="btn btn-square {{ "active" if page["active"] }}" href="{{url_for("changelog", revision=page["revision"])}}">{{page["i"]}}</a>
  {% endif %}
  {% endfor %}
  {% if next_page %}
  <!-- Next page -->
  <a class="btn btn-square" href="{{ url_for("changelog", revision=next_page) }}">
    <i class="fa fa-angle-right" aria-hidden="true"></i>
    <span class="sr-only">Next page</span> <!-- sr-only = only for screen readers -->
  </a>
  {% else %}
  <span class="btn btn-square">
    <i class="fa fa-angle-right" aria-hidden="true"></i>
  </span>
  {% endif %}
  <a class="btn btn-square" href="{{ url_for("changelog", revision=last_page) }}">
    <i class="fa fa-angle-double-right" aria-hidden="true"></i>
    <span class="sr-only">Last page</span> <!-- sr-only = only for screen readers -->
  </a>
</div>
<div class="text-right">
<i class="fas fa-rss"></i> <a href="{{url_for("changelog_feed_rss", _external=True)}}">rss</a> | <a href="{{url_for("changelog_feed_atom", _external=True)}}">atom</a>
</div>
</nav>
{% endif %}
</div>
{# log #}
<div class="w-full mw-full p-0">
    <div class="table-responsive table-striped">
      <table class="table">
        <thead>
          <tr>
            <th>Date</th>
            <th>Author</th>
            <th>Files</th>
            <th class="w-half">Commit Message</th>
          </tr>
        </thead>
        <tbody>
{% for entry in log %}
          <tr class="align-top">
            <td class="font-size-12"><span class="datetime" title="{{entry.datetime|format_datetime("deltanow")}} ago">{{entry.datetime|format_datetime}}</span>
                <a href="{{ url_for("show_commit", revision=entry.revision) }}" class="btn revision-small">{{entry.revision}}</a>{% if has_permission('WRITE') %} <a href="{{ url_for("revert", revision=entry.revision) }}"> <i class="fas fa-undo" alt="revert" title="revert commit {{entry.revision}}"></i></a>{% endif %}
            </td>
{# author #}
            <td>{%if not entry.author_email%}{{entry.author_name}}{%else%}<a href="mailto:{{entry.author_email}}">{{entry.author_name}}</a>{%endif%}</td>
{# files #}
            <td class="text-wrap">{% for fn,details in entry.files.items() %}
{% if details.url %}
<a href="{{details.url}}">{{details.name}}</a>
{% else %}
{{details.name}}
{% endif %}
{% endfor %}</td>
            <td class="text-wrap">{{entry.message or '-/-'|safe}}</td>
          </tr>
{% endfor %}
        </tbody>
      </table>
    </div>
</div>
{% endblock %}
